function  vecout = bootsample(vecin)
% Bootstraping from the array "vecin".
% Usage
%   vecout = bootsample(vecin)
% Input
%   vecin - nxp data matrix.
%   n - number of samples
%   p - dimension of a single observation
% Output
%   vecout - a bootstrap sample, size n x p, rows are bootstrap
%            realizations.
% Example
%   bootsam([1 2; 2 3; 3 4; 4 5]) 
%   ans =
%      4     5
%      3     4
%      4     5
%      3     4
% Brani 10/20/02

[n, p] = size(vecin);  

selected_indices = floor(1+n.*(rand(1,n)));
vecout = vecin(selected_indices,:);

